<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->increments('id');
            $table->string('username', 100)->unique()->comment('用户名（学号）');
            $table->string('password', 100)->comment('密码（已加密）');
            $table->string('fullname', 20)->comment('姓名');
            $table->integer('lucky')->comment('幸运数字');
            $table->integer('role')->comment('用户权限组（1为出题，2为审题，3为审查）');
            $table->integer('group')->comment('出题小组（0为不属于任何小组）');
            $table->boolean('is_alive')->comment('是否处于出题状态');
            $table->timestamp('register_at')->nullable()->comment('注册时间');
            $table->timestamp('last_login_at')->nullable()->comment('上次登录时间');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('users');
    }
}
